package gather;

import java.util.ArrayList;

public class G2 {
    public static void main(String[] args) {
        //创建集合对象，添加元素
        ArrayList<String> list = new ArrayList<>();
        list.add("点赞");
        list.add("收藏");
        list.add("转发");
        list.add("投币");

        //遍历集合 遍历注意打印和遍历区别
        System.out.print("[");
        for (int i = 0; i < list.size(); i++) {
            if (i == list.size() - 1){
                System.out.print(list.get(i));
            }else {
                System.out.print(list.get(i) + ",");
            }
        }
        System.out.println("]");
    }
}
